#include<stdio.h>
#define M 6
#define N 6
int main() {
    int m, n, sum = 0, i, j, a[M][N];

    scanf("%d%d", &m, &n);
    for (i = 0; i < m; i++) {
        sum = 0;
        for (j = 0; j < n; j++) {
            scanf("%d", &a[i][j]);
            sum += *(*(a + i) + j);
        }
        printf("%d\n", sum);



    }



    return 0;
}